package com.module.kernel.controller;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.module.kernel.service.IBdcdyService;
import com.support.helper.AjaxHelper;
import com.support.jdbc.Page;
import com.support.util.StringUtils;
import com.support.web.ControllerSupport;

@Controller
@Scope(value = "prototype")
@RequestMapping("/core")
public class LcqdController extends ControllerSupport
{
	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private IBdcdyService tdxxService;
	/**
	 * 按条件查询不动产单元列表信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getRecordBdcdy")
	public void getRecordBdcdy() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 按条件查询预抵押不动产单元列表信息
	 * 
	 */
	@RequestMapping("/getYdyBdcdy")
	public void getYdyBdcdy() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 按条件查询抵押不动产单元列表信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getDyBdcdy")
	public void getDyBdcdy() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 按条件查询预告不动产单元列表信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getYgzmBdcdy")
	public void getYgzmBdcdy() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 读宗地信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getZdxxByBdcdyh")
	public void getZdxxByBdcdyh() throws Exception
	{
		try
		{
			Map<String, String> params = this.getParamsMap();
			if (logger.isDebugEnabled())
			{
				logger.debug("LcqdController.getZdxxByBdcdyh:{}" + params);
			}

			if(StringUtils.isEmpty(params.get("BDCDYH")))
			{
				returnJSONView(AjaxHelper.toJSON("", AjaxHelper.FAILURE, "查询土地信息时，不动产单元号未传入"));
			}
			
			Map<String, Object> zdxx = tdxxService.queryTdxxByDyh(params.get("BDCDYH"));
			
			returnJSONView(AjaxHelper.toJSON(zdxx, AjaxHelper.SUCCESS, ""));
		}
		catch (Exception e)
		{
			if (logger.isErrorEnabled())
			{
				logger.debug("LcqdController.getZdxxByBdcdyh:{}" + e.getMessage());
			}

			returnJSONView(AjaxHelper.toJSON(null, AjaxHelper.FAILURE, e.getMessage()));
		}
	}

	/**
	 * 读房产信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getFcxxByBdcdyh")
	public void getFcxxByBdcdyh() throws Exception
	{
		try
		{
			Map<String, String> params = this.getParamsMap();
			
			if (logger.isDebugEnabled())
			{
				logger.debug("LcqdController.getFcxxByBdcdyh:{}" + params);
			}

			if(StringUtils.isEmpty(params.get("BDCDYH")))
			{
				returnJSONView(AjaxHelper.toJSON("", AjaxHelper.FAILURE, "查询房产信息时，不动产单元号未传入"));
			}
			
			Map<String, Object> zdxx = tdxxService.queryFcxxByDyh(params.get("BDCDYH"));
			
			returnJSONView(AjaxHelper.toJSON(zdxx, AjaxHelper.SUCCESS, ""));
		}
		catch (Exception e)
		{
			if (logger.isErrorEnabled())
			{
				logger.debug("LcqdController.getFcxxByBdcdyh:{}" + e.getMessage());
			}

			returnJSONView(AjaxHelper.toJSON(null, AjaxHelper.FAILURE, e.getMessage()));
		}
	}

	/**
	 * 获取预告申请人信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getYgsql")
	public void getYgsql() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 获取预抵押权人、预抵押人
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getYdyqrOrYdyr")
	public void getYdyqrOrYdyr() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 获取变更前抵押权人
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getDyqlr")
	public void getDyqlr() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 获取转移前抵押人
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getDyr")
	public void getDyr() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 获取原权利人
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getYqlr")
	public void getYqlr() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 获取权利人信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getQlr")
	public void getQlr() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 查询抵押登记信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getDydjxx")
	public void getDydjxx() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 查询预告登记信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getYgdjxx")
	public void getYgdjxx() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 查询预抵押登记信息
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getYdydjxx")
	public void getYdydjxx() throws Exception
	{
		Map<String, String> params = this.getParamsMap();
	}

	/**
	 * 通过不动产单元号判断是地还是房地一体
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getBdcZt")
	public void getBdcZt() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 检查是否存在有效的查封记录，有则取出最后一次的查封结束日期作为续查封的开始日期
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getXcfCfKsrq")
	public void getXcfCfKsrq() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 检查是否存在有效的查封（所有查封）记录，有则取出最后一次的查封结束日期作为轮候查封的开始日期
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getLhcfCfKsrq")
	public void getLhcfCfKsrq() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	// //////////////////////////下期开发//////////////////////////////////
	/**
	 * 查询地役权登记记录
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getDyqdjxx")
	public void getDyqdjxx() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 查询异议登记记录
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getYydjxx")
	public void getYydjxx() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

	/**
	 * 查询查封登记记录
	 * 
	 * @throws Exception
	 */
	@RequestMapping("/getCfdjxx")
	public void getCfdjxx() throws Exception
	{
		Page<?> page = this.getParamsPage4JQGrid();
	}

}
